<template>
  <el-form :model="form" label-width="auto" style="max-width: 600px">
    <el-form-item label="商品">
      <el-input v-model="form.aboutGood" />
    </el-form-item>
    <el-form-item label="商品URL">
      <el-input v-model="form.aboutGoodUrl" type="textarea" />
    </el-form-item>
    <el-form-item label="代发费用">
      <el-input v-model="form.aboutMoney" />
    </el-form-item>
    <el-form-item label="作品链接">
      <el-input v-model="form.creationUrl" type="textarea" />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">保存</el-button>
      <el-button>取消</el-button>
    </el-form-item>
  </el-form>
</template>

<script lang="ts" setup>
import { reactive } from 'vue'
import { userListAdd } from '../../../api/acl/user';
import { ElMessage } from 'element-plus'
// do not use same aboutGood with ref
const form = reactive({
  aboutGood: '',
  aboutGoodUrl: '',
  aboutMoney: "",
  creationUrl: "",
})

const onSubmit = async () => {
  console.log('submit!')
  let data = (await userListAdd(form)) as any;
  console.log(data,'data')
  if(data){
    ElMessage({
      message: '视频链接录入',
      type: 'success',
    })
    form.aboutGood = ''
    form.aboutGoodUrl = ''
    form.aboutMoney = ""
    form.creationUrl = ""
  }
}
</script>
